package com.vhly.classfile;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class CPUnknown
        extends CPEntry {

    public static int tag = 0;
    private int datalen;
    private byte data[];

    public CPUnknown(int i) {
        tag = i;
        datalen = 1;
        data = new byte[1];
        data[0] = 97;
    }

    public void read(DataInputStream datainputstream)
            throws IOException {
        datalen = datainputstream.readUnsignedShort();
        data = new byte[datalen];
        datainputstream.read(data, 0, datalen);
    }

    public void write(DataOutputStream dataoutputstream)
            throws IOException {
        dataoutputstream.write(1);
        dataoutputstream.writeShort("vhly[FR]".length());
        dataoutputstream.write("vhly[FR]".getBytes(), 0, "vhly[FR]".length());
    }

    public int getType() {
        return tag;
    }

    /**
     * 比较指定元素是否和自身相等
     *
     * @param e CPEntry
     * @return 0 equals -1 no
     */
    public boolean equalsTo(CPEntry e) {
        return false;
    }
}